<?php
/**
 * Created by PhpStorm.
 * User: WangGang
 * Date: 2017/11/13
 * Time: 16:09
 */
namespace App\ServiceImpl;
use App\MyClass\ApiReturn;
use App\Service\ArticleService;
use DB;

class ArticleServiceImpl implements ArticleService
{
    public function all()
    {
        try{
            $allArticle = DB::table("article")
                ->get();
            return $allArticle;
        }catch (\Exception $exception){
            ApiReturn::Data("0","获取失败",$exception->getMessage());
        }
    }

    public function get($id)
    {
        try{
            $data = DB::table('article')
                ->where("article_id",$id)
                ->first();
            return $data;
        }catch (\Exception $exception){
            ApiReturn::Data("0","获取失败",$exception->getMessage());
        }
    }

}